BX.namespace("BX.Landing");BX.Landing.EditComponent=function(){this.actionCloseId=BX("action-close");if(this.actionCloseId){BX.bind(this.actionCloseId,"click",BX.delegate(this.actionClose,this))}};BX.Landing.EditComponent.prototype={actionClose:function(){if(typeof top.BX.SidePanel!=="undefined"){setTimeout((function(){top.BX.SidePanel.Instance.close()}),300);top.BX.SidePanel.Instance.postMessage(window,"landingEditClose",{})}}};BX.Landing.SelectColor=function(e){this.id=e.id?e.id:"";this.options=e.options?e.options:[];this.value=e.value?e.value:"";this.DOM={}};BX.Landing.SelectColor.prototype={show:function(){this.checkValue();this.initSectionSelector()},checkValue:function(){if(!this.options[this.value]){this.value=Object.keys(this.options)[0]}},initSectionSelector:function(){this.DOM.sectionWrap=BX(this.id+"_select_color_wrap");this.DOM.sectionInput=BX(this.id+"_select_color");this.DOM.sectionSelect=this.DOM.sectionWrap.appendChild(BX.create("DIV",{props:{className:"select-color-field"}}));this.DOM.sectionSelectInner=this.DOM.sectionSelect.appendChild(BX.create("DIV",{props:{className:"select-color-field-icon"},style:{backgroundColor:this.options[this.value].color}}));this.DOM.sectionSelectInnerText=this.DOM.sectionSelect.appendChild(BX.create("SPAN",{text:this.options[this.value].name}));BX.bind(this.DOM.sectionSelect,"click",o);var e=this,t=this.options;function o(){if(e.sectionMenu&&e.sectionMenu.popupWindow&&e.sectionMenu.popupWindow.isShown()){return e.sectionMenu.close()}var o,n=[],i;for(var s in t){n.push({id:"bx-select-color-option-"+s,text:BX.util.htmlspecialchars(t[s].name),color:t[s].color,className:"select-color-popup-menu-item "+(t[s].class?t[s].class:""),onclick:function(o){return function(){var n=t[o];e.DOM.sectionInput.value=o;e.DOM.sectionSelectInner.style.backgroundColor=n.color;e.DOM.sectionSelectInnerText.innerHTML=BX.util.htmlspecialchars(n.name);e.sectionMenu.close()}}(s)})}e.sectionMenu=BX.PopupMenu.create("selectColor"+e.id,e.DOM.sectionSelect,n,{closeByEsc:true,autoHide:true,offsetTop:0,offsetLeft:0});e.sectionMenu.popupWindow.contentContainer.style.maxHeight="300px";e.sectionMenu.popupWindow.setWidth(e.DOM.sectionSelect.offsetWidth-2);e.sectionMenu.show();for(o=0;o<e.sectionMenu.menuItems.length;o++){if(e.sectionMenu.menuItems[o].layout.item){i=e.sectionMenu.menuItems[o].layout.item.querySelector(".menu-popup-item-icon");if(i){i.style.backgroundColor=e.sectionMenu.menuItems[o].color}}}BX.addClass(e.DOM.sectionSelect,"active");BX.addCustomEvent(e.sectionMenu.popupWindow,"onPopupClose",(function(){BX.removeClass(e.DOM.sectionSelect,"active");e.sectionMenu=null;BX.PopupMenu.destroy("selectColor"+e.id)}))}}};BX.ready((function(){var e=[].slice.call(document.querySelectorAll(".landing-frame-btn"));for(var t=0,o=e.length;t<o;t++){BX.bind(e[t],"click",(function(){top.BX.SidePanel.Instance.open(this.getAttribute("href"),{width:1e3,allowChangeHistory:false,events:{onClose:function(e){if(e.slider.url.indexOf("save=Y")!==-1||e.slider.url.indexOf("switch=Y")!==-1){window.location.reload()}}}});BX.PreventDefault()}))}}));function showAllColors(){var e=document.getElementById("set-colors");for(var t=0;t<e.childNodes.length;t++){e.childNodes[t].hidden=false}var o=document.getElementById("link-all-colors");o.hidden=true}
//# sourceMappingURL=script.map.js